package skyinline.j2ee.basic.util.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class MysqlDB {
	private static String DRV = "org.mariadb.jdbc.Driver";
	private static String URL = "jdbc:mariadb://localhost:3306/siestageek?user=siestageek&password=987654";
	
	public static Connection openConn() {
		try {
			Class.forName(DRV);
			return DriverManager.getConnection(URL);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	public static void closeConn( 
		Connection c, PreparedStatement p, ResultSet r ) {
		if (r != null) try {r.close(); r = null;} catch (Exception e) {}
		if (p != null) try {p.close(); p = null;} catch (Exception e) {}
		if (c != null) try {c.close(); c = null;} catch (Exception e) {}
	}
	
}







